//
//  AZMainTabBarViewController.swift
//  sinaWB
//
//  Created by AzeryKiss on 16/2/25.
//  Copyright © 2016年 AzeryKiss. All rights reserved.
//

import UIKit

class AZMainTabBarViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()



        
        addChildViewController()

        setValue(AZTabBar(), forKey: "tabBar")
    }
    
    // 设置tabbar及控制器
    func addChildViewController() {
        
        addChildViewController(AZHomeViewController(), title: "首页", image: "tabbar_home")
        addChildViewController(AZMessageViewController(), title: "消息", image: "tabbar_message_center")
        
        addChildViewController(AZFindViewController(), title: "发现", image: "tabbar_discover")
        addChildViewController(AZSettingViewController(), title: "设置", image: "tabbar_profile")
    }

    func addChildViewController(childController: UIViewController, title: String, image: String) {
        
        childController.title = title
        
        childController.tabBarItem.image = UIImage(named: image)
        
        childController.tabBarItem.selectedImage = UIImage(named: (image + "_highlighted"))
        
        UITabBar.appearance().tintColor = UIColor.orangeColor()
        
    
        
        addChildViewController(UINavigationController(rootViewController: childController))
        
    }


}
